package org.osomit.sacct.builder;

import org.osomit.sacct.entity.SessionInfo;

import java.util.Map;

/**
 * @author Jian Fang (John.Jian.Fang@gmail.com)
 *
 * Date: Jul 2, 2009
 */
public class SessionInfoBuilder extends BaseBuilder<SessionInfo> {

    public SessionInfo build(Object object) {
        if (object != null) {
            SessionInfo sinfo = new SessionInfo();
            Map map = (Map) object;
            sinfo.setServerPublicKey((String) map.get(SessionInfo.SERVER_PUBLIC_KEY));
            sinfo.setSessionId((String) map.get(SessionInfo.SESSION_ID));

            return sinfo;
        }

        return null;
    }
}
